﻿using System;

namespace Sidvall.Business
{
	public class CollectionChangedEventArgs : EventArgs
	{
		public CollectionChangedAction Action { get; private set; }
		public object Item { get; private set; }
		public int OldIndex { get; private set; }
		public int NewIndex { get; private set; }
		public bool Cancel { get; set; }

		public CollectionChangedEventArgs(CollectionChangedAction action)
		{
			this.Cancel = false;
			this.Action = action;
		}
		public CollectionChangedEventArgs(CollectionChangedAction action, object item, int index)
			: this(action)
		{
			this.Item = item;
			this.NewIndex = index;
		}
		public CollectionChangedEventArgs(CollectionChangedAction action, object item, int oldIndex, int newIndex)
			: this(action, item, newIndex)
		{
			this.OldIndex = oldIndex;
		}
	}
}
